<?php $this->_extends('_layouts/basic_layout'); ?>

<?php $this->_block('resource'); ?>

<?php $this->_endblock(); ?>

<?php $this->_block('title'); ?>
	Type - Jqueryplugins
<?php $this->_endblock(); ?>

<?php $this->_block('admin_contents'); ?>
<div class="row-fluid">		<!-- sortable ui-sortable -->
	<div class="box span12">
		<div class="box-header well">
			<h2><i class="icon-user"></i> Jquery Plugins类别</h2>
		</div>
		<div class="box-content">
			<div role="grid" id="area">
				<div class="row-fluid"> 	<!-- sortable ui-sortable -->
					<form class="form-inline" action="<?php echo url('types/jqueryplugin', array('ope' => 'add')); ?>" method="post">
						<fieldset>
							<legend>分类</legend>
							
							<label class="control-label" for="name">名称(Zh)：</label>
							<input name="name" id="name" type="text" />
							
							<label class="control-label" for="name_en">名称(En)：</label>
							<input name="name_en" id="name_en" type="text" />
							
							<input type="submit" value="添加" class="btn" />
						</fieldset>
					</form>
				</div>
				<div class="row-fluid">
					<table class="table table-striped table-bordered">
						<thead>
							<tr role="row">
								<th>名称(Zh)</th>
								<th>名称(En)</th>
								<th>默认值</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<?php if(!empty($types)): foreach($types as $jq_t): ?>
								<tr>
									<td><?php echo $jq_t['name']; ?></td>
									<td><?php echo $jq_t['name_en']; ?></td>
									<td><?php echo ($jq_t['is_default'] == 1)? '是' : ''; ?></td>
									<td>
										<a href="<?php echo url('types/jqueryplugin', array('ope' => 'delete', 'id' => $jq_t['id'])); ?>">删除</a>
										<a href="<?php echo url('types/jqueryplugin', array('ope' => 'setdefault', 'id' => $jq_t['id'])); ?>">设为默认</a>
									</td>
								</tr>
							<?php endforeach; endif; ?>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>

<?php $formErrors = json_encode($typeModel->getValidateError()); ?>
<script>
$.each(<?php echo $formErrors; ?>, function(item, errors){
	$.each(errors, function(k, error){
		noty({
			'text': item + ': ' + error,
			'layout': 'topRight',
			'type': 'error'
		});
	});
});
</script>
<?php $this->_endblock(); ?>